package com.example.shop.modules.manage.controller;


import com.example.shop.modules.manage.service.IIndexSalesadminService;
import com.example.shop.persistence.entity.IndexSales;
import com.example.shop.utils.JSONResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import static com.example.shop.utils.JSONResult.renderSuccess;

/**
 * <p>
 * 首页商品促销分类表 前端控制器
 * </p>
 *
 * @author jason
 * @since 2020-06-15
 */
@Api(tags = "后台接口商品促销分类表")
@RestController
@RequestMapping("/manage/indexSales")
public class IndexSalesAdminController {

    @Autowired
    private IIndexSalesadminService indexSalesService;

    @PostMapping
    @ApiOperation(value = "新增或修改")
    public JSONResult addSales(IndexSales indexSales){
        return renderSuccess(indexSalesService.saveOrUpdate(indexSales));
    }

    @DeleteMapping
    @ApiOperation(value = "删除")
    public JSONResult deleteSales(Integer id){
        return renderSuccess(indexSalesService.removeById(id));
    }

    @GetMapping
    @ApiOperation(value = "查询")
    public JSONResult selectSales(){
        return indexSalesService.selectSales();
    }
}

